#ifndef _GRAPHLIST_H_
#define _GRAPHLIST_H_

struct EdgeNode;

typedef int AdjType;

typedef struct EdgeNode * PEdgeNode;
typedef struct EdgeNode * EdgeList;

struct EdgeNode
{
    int endvex;
    AdjType weight; 
    PEdgeNode nextEdge;
};

typedef struct
{
    VexType vertex;
    EdgeList edgeList;
} VexNode;


typedef VexNode * Vertex;

typedef struct
{
    int n;
    VexNode * vexs;
} GraphList;
 
typedef GraphList * PGraphList;

PGraphList createGraph(int n, AdjType ajt[][]);

int isNullGraph(PGraphList graph);

Vertex firstVertex(PGraphList graph);
Vertex nextVertex(PGraphList graph, Vertex vi);
int deleteVertex(PGraphList graph, Vertex vi);

int deleteEdge(PGraphList graph, Vertex vi, Vertex vj);
int addEdge(PGraphList grpah, Vertex vi, Vertex vj);
int findEdge(PGraphList graph, Vertex vi, Vertex vj);

void dftGraph(PGraphList graph);
void dfsGraph(PGraphList graph, Vertex vi);
void bftGraph(PGraphList graph);
void bfsGraph(PGraphList graph, Vertex vi);

int destroyGraph(PGraphList *graph);
#endif
